<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>给标签文本添加内容</title>
    <script>
        var index=4;
        onload=function () {
            setInterval(changtime,1000);
            function changtime() {
                document.getElementById("h2");
                h2.innerText="该页面将在"+index+"跳转百度"
                index--;
                if (index==0){
                    location.href="http://www.baidu.com/"
                }
            }
        }
    </script>

</head>
<body>
<font id="h2"></font>
</body>
</html>